#include "StdAfx.h"
#include "MainMenuCon.h"
#include "Util/UtilInclude.h"
#include "CommandDef.h"
#include "MainPro.h"
#include "IResCfg.h"
#include "IAlphaMulBtn.h"
#include "FAlpResIcon.h"
#include "CPollyAlphBtn.h"

static int g_count;
void CALLBACK LongPessedProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime )
{
	g_count++;
}
CMainMenuCon::CMainMenuCon(HWND hWnd):CImproveCon(hWnd)
{
	
}

CMainMenuCon::~CMainMenuCon(void)
{
}

BOOL CMainMenuCon::InitControls(DWORD dwData)
{
	LANGUAGE_DECLARE;
	FONT_DECLARE;
	if(!m_config.Init(L"MAIN.xml"))
	{
		//g_App.ShowMsgBox(CMD_MSGBOX_OK,L"",LAN_GETTEXT(Msg_ResError));
		//return FALSE;
	}

	BOOL bFromDll	= m_config.IsResFromDll();
	wstring str		= m_config.GetImage();		
	HBITMAP hBitmap = CUtil::LoadBitmapEx(str.c_str(),m_config.m_bFromDll);
	SetBackGnd(hBitmap);

	SetRect( m_config.GetRect() );


	BtnParam btnInfo;
	BtnParam btnEbookInfo;	
	TextParam txtInfo;
	CBmpBtn*	pBtn = NULL;
	CText*		pTxt = NULL;
    IBtnInfo  AlphabtnInfo;
	CFAlpResBtn *pAlpahBtn=NULL;
	CPolyAlphBtn *pPolyAlphBtn=NULL;
	InitImproveContainer();
	CMyUnCompress* pUnPack = NULL;
	wstring strImgBK = CUtil::GetResPath() + TEXT("AlphaBmp\\Bk.bmp");
	LoadBKRes( strImgBK,pUnPack );

	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_CustomWork");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
    pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_CSUTOMWORK ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_PLLOY);
	pPolyAlphBtn->SetPloyPoint(CPoint(133,305));
	pPolyAlphBtn->SetPloyPoint(CPoint(137,360));
    pPolyAlphBtn->SetPloyPoint(CPoint(171,396));
	pPolyAlphBtn->SetPloyPoint(CPoint(336,386));
	pPolyAlphBtn->SetPloyPoint(CPoint(312,341));
	pPolyAlphBtn->SetPloyPoint(CPoint(352,305));
	pPolyAlphBtn->SetPloyPoint(CPoint(210,236));
	pPolyAlphBtn->SetPloyPoint(CPoint(154,258));
	//pPolyAlphBtn->Show(false);


	//m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_CustomWork");
	//AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	//AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	//AlphabtnInfo.m_strImgDisable=L"";
	//pAlpahBtn=(CFAlpResBtn*)this->AddBaseIControl( new CFAlpResBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINMENU_TV ),0 );
	//m_config.ReInitFAlpBtn(pAlpahBtn,AlphabtnInfo);

	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_Round");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_ROUND),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_PLLOY);
	pPolyAlphBtn->SetPloyPoint(CPoint(269,101));
	pPolyAlphBtn->SetPloyPoint(CPoint(234,166));
	pPolyAlphBtn->SetPloyPoint(CPoint(258,222));
	pPolyAlphBtn->SetPloyPoint(CPoint(382,300));
	pPolyAlphBtn->SetPloyPoint(CPoint(378,244));
	pPolyAlphBtn->SetPloyPoint(CPoint(443,251));
	pPolyAlphBtn->SetPloyPoint(CPoint(368,95));
	pPolyAlphBtn->SetPloyPoint(CPoint(319,82));
	//pPolyAlphBtn->Show(false);
	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_Font");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_FONT ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_PLLOY);
	pPolyAlphBtn->SetPloyPoint(CPoint(508,13));
	pPolyAlphBtn->SetPloyPoint(CPoint(448,35));
	pPolyAlphBtn->SetPloyPoint(CPoint(426,81));
	pPolyAlphBtn->SetPloyPoint(CPoint(469,226));
	pPolyAlphBtn->SetPloyPoint(CPoint(507,200));
	pPolyAlphBtn->SetPloyPoint(CPoint(557,226));
	pPolyAlphBtn->SetPloyPoint(CPoint(594,79));
	pPolyAlphBtn->SetPloyPoint(CPoint(575,32));
	//pPolyAlphBtn->Show(false);



	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_Back");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_BACK ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_PLLOY);
	pPolyAlphBtn->SetPloyPoint(CPoint(760,102));
	pPolyAlphBtn->SetPloyPoint(CPoint(704,81));
	pPolyAlphBtn->SetPloyPoint(CPoint(650,97));
	pPolyAlphBtn->SetPloyPoint(CPoint(585,254));
	pPolyAlphBtn->SetPloyPoint(CPoint(638,247));
	pPolyAlphBtn->SetPloyPoint(CPoint(650,299));
	pPolyAlphBtn->SetPloyPoint(CPoint(781,210));
	pPolyAlphBtn->SetPloyPoint(CPoint(790,152));
	//pPolyAlphBtn->Show(false);
	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_Fit");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_FITSTREAM ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_PLLOY);
	pPolyAlphBtn->SetPloyPoint(CPoint(894,318));
	pPolyAlphBtn->SetPloyPoint(CPoint(803,254));
	pPolyAlphBtn->SetPloyPoint(CPoint(675,329));
	pPolyAlphBtn->SetPloyPoint(CPoint(716,362));
	pPolyAlphBtn->SetPloyPoint(CPoint(694,411));
	pPolyAlphBtn->SetPloyPoint(CPoint(841,419));
	pPolyAlphBtn->SetPloyPoint(CPoint(781,210));
	pPolyAlphBtn->SetPloyPoint(CPoint(895,375));
   // pPolyAlphBtn->Show(false);


	
	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_QuickStart");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_QUICKSTART ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_CRICLE);
;
	pPolyAlphBtn->SetPloyCtrlRadius(102,CPoint(512,397));


	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_CustomWork_I");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_CSUTOMWORK_I ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_CRICLE);
	pPolyAlphBtn->SetPloyCtrlRadius(AlphabtnInfo.m_rc.Width()/2,CPoint(AlphabtnInfo.m_rc.left+AlphabtnInfo.m_rc.Width()/2,AlphabtnInfo.m_rc.top+AlphabtnInfo.m_rc.Width()/2));
   // pPolyAlphBtn->Show(false);

	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_Round_I");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_ROUND_I ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_CRICLE);
	pPolyAlphBtn->SetPloyCtrlRadius(AlphabtnInfo.m_rc.Width()/2,CPoint(AlphabtnInfo.m_rc.left+AlphabtnInfo.m_rc.Width()/2,AlphabtnInfo.m_rc.top+AlphabtnInfo.m_rc.Width()/2));
	//pPolyAlphBtn->Show(false);




	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_Font_I");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_FONT_I ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_CRICLE);
	pPolyAlphBtn->SetPloyCtrlRadius(AlphabtnInfo.m_rc.Width()/2,CPoint(AlphabtnInfo.m_rc.left+AlphabtnInfo.m_rc.Width()/2,AlphabtnInfo.m_rc.top+AlphabtnInfo.m_rc.Width()/2));
	//pPolyAlphBtn->Show(false);




	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_Back_I");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_BACK_I ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_CRICLE);
	pPolyAlphBtn->SetPloyCtrlRadius(AlphabtnInfo.m_rc.Width()/2,CPoint(AlphabtnInfo.m_rc.left+AlphabtnInfo.m_rc.Width()/2,AlphabtnInfo.m_rc.top+AlphabtnInfo.m_rc.Width()/2));
	//pPolyAlphBtn->Show(false);




	m_config.LoadIBtnParam(AlphabtnInfo,L"Btn_Fit_I");
	AlphabtnInfo.m_strImgNor= CUtil::GetResPath()+AlphabtnInfo.m_strImgNor;
	AlphabtnInfo.m_strImgAct=CUtil::GetResPath()+AlphabtnInfo.m_strImgAct;;
	AlphabtnInfo.m_strImgDisable=L"";
	pPolyAlphBtn=(CPolyAlphBtn*)this->AddBaseIControl( new CPolyAlphBtn(SBS_RECT, L"", AlphabtnInfo.m_rc,CMD_MAINNEU_FITSTREAM_I ),0 );
	m_config.ReInitFAlpBtn(pPolyAlphBtn,AlphabtnInfo);
	pPolyAlphBtn->SetPloyCtrlType(SHARP_TYPE::TYPE_CRICLE);
	pPolyAlphBtn->SetPloyCtrlRadius(AlphabtnInfo.m_rc.Width()/2,CPoint(AlphabtnInfo.m_rc.left+AlphabtnInfo.m_rc.Width()/2,AlphabtnInfo.m_rc.top+AlphabtnInfo.m_rc.Width()/2));
	//pPolyAlphBtn->Show(false);

 

	m_config.GetBtnParam(btnInfo,L"Btn_Start"); 
	pBtn = (CBmpBtn*)this->AddControl(new CBmpBtn(SBS_RECT,LAN_GETTEXT(HS_START), btnInfo.m_rc, CMD_MAINNEU_GETSTART));
	m_config.SetBtnParam(pBtn,btnInfo);
    wstring strlang=CConfig::GetInstance()->GetLanguage();
	m_config.GetBtnParam(btnInfo,L"Btn_Lang");
	CUtil::TrimFileExtension(strlang);
	
	btnInfo.m_strImg=L"main\\LangBtn"+strlang+L".bmp";

	pBtn = (CBmpBtn*)this->AddControl(new CBmpBtn(SBS_RECT,LAN_GETTEXT(strlang), btnInfo.m_rc, CMD_MAINNEU_LAN));
	
	m_config.SetBtnParam(pBtn,btnInfo);


  
	m_config.GetBtnParam(btnInfo,L"Btn_Rotary");
	pBtn = (CBmpBtn*)this->AddControl(new CBmpBtn(SBS_RECT,LAN_GETTEXT(HS_ROTARY), btnInfo.m_rc, CMD_MAINNEU_ROTYMOTION));
	m_config.SetBtnParam(pBtn,btnInfo);

	m_config.GetTextParam(txtInfo,L"Text_Tip");
	CText* pCaption = (CText*)AddControl(new CText(SWS_STATIC, LAN_GETTEXT(HS_TIPS1), txtInfo.m_rc, CMD_MAINNEU_TIPS));
	m_config.SetTextParam(pCaption,txtInfo);
	pCaption->SetTxtNormal(RGB(0,0,0));


	ProgressParam proInfo;
	m_config.GetProgreeParam(proInfo,L"Pro_Welcome");
	m_pProgress = (CTimeProgress*)AddControl(new CTimeProgress(SBS_RECT, L"", proInfo.m_rc, CMD_MAINNEU_PRO_WEL));
	m_config.SetProgressParam(m_pProgress,proInfo);
	m_pProgress->SetRange(0,6);
	m_pProgress->SetPos(1);



 	//SetPainter( new CMainMenuPainter( ));
	return bRet;
}
 void CMainMenuCon::ChangeLang()
 {
	 LANGUAGE_DECLARE;
	 wstring strLang=CConfig::GetInstance()->GetLanguage();
	 CUtil::TrimFileExtension(strLang);
	 BtnParam btnInfo;
	 m_config.GetBtnParam(btnInfo,L"Btn_Lang");
	 btnInfo.m_strImg=L"main\\LangBtn"+strLang+L".bmp";



	 CBmpBtn*  pBtn = (CBmpBtn*)ControlFromID(CMD_MAINNEU_LAN);
	 
    
	 m_config.SetBtnParam(pBtn,btnInfo);
	 pBtn->SetCaption(LAN_GETTEXT(strLang));

	 pBtn=(CBmpBtn*)this->ControlFromID(CMD_MAINNEU_GETSTART);
	 if(pBtn)
	 {
		 pBtn->SetCaption(LAN_GETTEXT(HS_START));
	 }


	 pBtn = (CBmpBtn*)this->ControlFromID(CMD_MAINNEU_ROTYMOTION);
	 if(pBtn)
	 {
		 pBtn->SetCaption(LAN_GETTEXT(HS_ROTARY));
	 }

	 CText* pCaption = (CText*)this->ControlFromID(CMD_MAINNEU_TIPS);
	 if(pCaption)
	 {
		 switch(m_pProgress->GetPos())
		 {
		 case 1:
			 pCaption->SetCaption(LAN_GETTEXT(HS_TIPS1));
			 break;
		 case 2:
			 pCaption->SetCaption(LAN_GETTEXT(HS_TIPS2));
			 break;
		 case 3:
			 pCaption->SetCaption(LAN_GETTEXT(HS_TIPS3));
			 break;
		 case 4:
			 pCaption->SetCaption(LAN_GETTEXT(HS_TIPS4));
			 break;
		 case 5:
			 pCaption->SetCaption(LAN_GETTEXT(HS_TIPS5));
			 break;

		 case 6:
			 pCaption->SetCaption(LAN_GETTEXT(HS_TIPS6));
			 break;
		 }
	 }

 }
void CMainMenuCon::OnLButtonDown(UINT nFlags, CPoint point)
{
	//here the order change
	
	
	CRect rc;
	rc.SetRect(300,535,380,570);
	if (PtInRect(&rc,point))
	{
		g_count=0;
		SetTimer(m_hWnd,0x2012,1000,LongPessedProc);

	}
	
	
	
	LISTCTRL* pList[LEV_ALL] = { &m_vICtrlTop ,&m_vICtrlMid, &m_vICtrlLow };
	CBaseICtrl* pICtrl = NULL;




	for ( int i=0;i<LEV_ALL;i++ )
	{
		LISTCTRL::iterator lite  = pList[i]->begin();
		for(; lite!=pList[i]->end(); ++lite ) 
		{
			pICtrl = *lite;
			if (pICtrl->GetID()>CMD_MAINNEU_FITSTREAM)
			{

				if( pICtrl!=NULL && pICtrl->GetRect().PtInRect(point) )
				{
					if((pICtrl->GetStyle() & SWS_STATIC) || !pICtrl->IsVisible() )
					{
						pICtrl = NULL;
						continue;
					}
					else
					{
						m_pHotICtrl = pICtrl;
						pICtrl->Click(CLICK_DOWN, point);
						return ;
					}
				}	
			}
			else
			{


				if( pICtrl!=NULL &&(((CPolyAlphBtn*)pICtrl)->PointInPloygCtrl(point)) )
				{
					if((pICtrl->GetStyle() & SWS_STATIC) || !pICtrl->IsVisible() )
					{
						pICtrl = NULL;
						continue;
					}
					else
					{
						m_pHotICtrl = pICtrl;
						pICtrl->Click(CLICK_DOWN, point);
						return ;
					}
				}	


			}
		}
	}

	CContainer::OnLButtonDown( nFlags,point );


}
static int iClick=0;
void CMainMenuCon::OnLButtonUp(UINT nFlags, CPoint point)
{
	
	
	
	
	if (g_count>2)
	{

	 CUtil::PlayBeepSound();
	 PostMessage(m_hWnd,WM_CLICK_LONG, CMD_MAINNEU_BACK,NULL);
	}
	
	
	CRect rc;
	rc.SetRect(0,595,5,600);
	if (PtInRect(&rc,point))
	{
		iClick++;

	}
	if (iClick>3)
	{
		STARTUPINFO si;
		PROCESS_INFORMATION info;

		ZeroMemory( &si, sizeof(si) );
		si.cb = sizeof(si);
		ZeroMemory( &info, sizeof(info) );
		if (CreateProcess(L"\\windows\\explorer.exe",NULL,NULL,NULL,NULL,0,NULL,NULL,&si,&info))
		{
			
			iClick=0;
			CUtil::ShowTaskBar(true);
			PostMessage(m_hWnd, WM_CLOSE, 0, 0);
			CloseHandle(info.hThread);
			CloseHandle(info.hProcess);
		}	
	}



	if ( m_pHotICtrl !=NULL )
	{
		m_pHotICtrl->Click(CLICK_UP, point);
		m_pHotICtrl = NULL;
		InvalidateRect( m_hWnd,m_pHotICtrl->GetRect(),FALSE );
		return ;
	}

	CContainer::OnLButtonUp( nFlags,point );
}

void CMainMenuCon::OnCommand(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
	switch (wParam)
	{
	case CMD_MAINNEU_QUICKSTART:
		{
			g_App.SetToDefaultSetting();
			wstring sDir = CUtil::GetCurrentDirectory();
			sDir += L"\\workout.exe";
			if(GetFileAttributes(sDir.c_str()) != -1)
			{

				STARTUPINFO si;
				PROCESS_INFORMATION info;

				ZeroMemory( &si, sizeof(si) );
				si.cb = sizeof(si);
				ZeroMemory( &info, sizeof(info) );


				if (CreateProcess(sDir.c_str(),L"F",NULL,NULL,NULL,0,NULL,NULL,&si,&info))
				{
					g_App.m_bNeedScreen=false;
					//SetCursor( NULL );
					ShowCursor(SW_HIDE);
			         KillTimer(m_hWnd,FONT_ALPHA);
					KillTimer(m_hWnd,START_INTERVAL);
					KillTimer(m_hWnd,SCREEN_PROTECTED);
					CloseHandle(info.hThread);
					CloseHandle(info.hProcess);
				}	




			}
		}
		break;
	case CMD_MAINNEU_ROUND:	
		{
			//g_App.SetToDefaultSetting(L"2");
			wstring sDir = CUtil::GetCurrentDirectory();
			sDir += L"\\workout.exe";
			if(GetFileAttributes(sDir.c_str()) != -1)
			{

				STARTUPINFO si;
				PROCESS_INFORMATION info;

				ZeroMemory( &si, sizeof(si) );
				si.cb = sizeof(si);
				ZeroMemory( &info, sizeof(info) );


				if (CreateProcess(sDir.c_str(),_T("R"),NULL,NULL,NULL,0,NULL,NULL,&si,&info))
				{
					g_App.m_bNeedScreen=false;
					//SetCursor( NULL );
					ShowCursor(SW_HIDE);
					KillTimer(m_hWnd,FONT_ALPHA);
					KillTimer(m_hWnd,SCREEN_PROTECTED);
					KillTimer(m_hWnd,START_INTERVAL);
					CloseHandle(info.hThread);
					CloseHandle(info.hProcess);
				}	
			}
		}
		break;
	case CMD_MAINNEU_FONT:	
		{
			g_App.SetToDefaultSetting(L"0");
			wstring sDir = CUtil::GetCurrentDirectory();
			sDir += L"\\setting.exe";
			if(GetFileAttributes(sDir.c_str()) != -1)
			{

				STARTUPINFO si;
				PROCESS_INFORMATION info;

				ZeroMemory( &si, sizeof(si) );
				si.cb = sizeof(si);
				ZeroMemory( &info, sizeof(info) );


				if (CreateProcess(sDir.c_str(),NULL,NULL,NULL,NULL,0,NULL,NULL,&si,&info))
				{
					g_App.m_bNeedScreen=false;
					//SetCursor( NULL );
					ShowCursor(SW_HIDE);
				    KillTimer(m_hWnd,FONT_ALPHA);
					KillTimer(m_hWnd,SCREEN_PROTECTED);
					KillTimer(m_hWnd,START_INTERVAL);
					CloseHandle(info.hThread);
					CloseHandle(info.hProcess);
				}	
			}
		}
		break;
	case  CMD_MAINNEU_BACK:
		{
			g_App.SetToDefaultSetting(L"1");
			wstring sDir = CUtil::GetCurrentDirectory();
			sDir += L"\\setting.exe";
			if(GetFileAttributes(sDir.c_str()) != -1)
			{

				STARTUPINFO si;
				PROCESS_INFORMATION info;

				ZeroMemory( &si, sizeof(si) );
				si.cb = sizeof(si);
				ZeroMemory( &info, sizeof(info) );


				if (CreateProcess(sDir.c_str(),NULL,NULL,NULL,NULL,0,NULL,NULL,&si,&info))
				{
					g_App.m_bNeedScreen=false;
					//SetCursor( NULL );
					ShowCursor(SW_HIDE);
					 KillTimer(m_hWnd,FONT_ALPHA);
					KillTimer(m_hWnd,SCREEN_PROTECTED);
					KillTimer(m_hWnd,START_INTERVAL);
					CloseHandle(info.hThread);
					CloseHandle(info.hProcess);
				}	
			}
		}
		break;
	
	case CMD_MAINNEU_CSUTOMWORK:
		{
			g_App.SetToDefaultSetting();
			wstring sDir = CUtil::GetCurrentDirectory();
			sDir += L"\\custom.exe";
			if(GetFileAttributes(sDir.c_str()) != -1)
			{

				STARTUPINFO si;
				PROCESS_INFORMATION info;

				ZeroMemory( &si, sizeof(si) );
				si.cb = sizeof(si);
				ZeroMemory( &info, sizeof(info) );


				if (CreateProcess(sDir.c_str(),NULL,NULL,NULL,NULL,0,NULL,NULL,&si,&info))
				{
					g_App.m_bNeedScreen=false;
					//SetCursor( NULL );
					ShowCursor(SW_HIDE);
					KillTimer(m_hWnd,FONT_ALPHA);
					KillTimer(m_hWnd,SCREEN_PROTECTED);
					KillTimer(m_hWnd,START_INTERVAL);
					CloseHandle(info.hThread);
					CloseHandle(info.hProcess);
				}	
			}
		}
		break;
	case CMD_MAINNEU_CSUTOMWORK_I:
		
		break;



	}



}
